<template>
  <div class="flowDialog">
    <el-dialog
        title="客户基础信息"
        :visible.sync="searchPurchaseDialogShow"
        width="80%"
        :before-close="handleClose"
    >
      <tableList
          :showIndex="true"
          :radioSelect="true"
          border
          highlight-current-row
          :heightMin="130"
          :pageNumber="current"
          :pageSize="size"
          :total="total"
          :keySet="keySet"
          :tableData="listDetails"
          :paginationShow="true"

          @handleSizeChange="handleSizeChange"
          @handleCurrentChange="handleCurrentChange"
          @rowDblclick="rowDblclick"

      >
      </tableList>
    </el-dialog>
  </div>
</template>
<script>
import tableList from '@/components/tableList/index.vue'
import {getPage} from "@/api/custom";
import mixinTable from "@/mixin/mtable";

export default {
  model: {
    prop: 'searchPurchaseDialogShow',
    event: 'change'
  },
  props: {
    searchPurchaseDialogShow: {
      type: Boolean,
      default: false,
    },
  },
  mixins: [mixinTable],
  data() {
    return {
      keySet: [
        {
          label: '获票人名称',
          englishName: 'hprmc',
        },
        {
          label: '开票人纳税人识别号',
          englishName: 'kprnsrsbh',
                              width: 'labelWidth',
        },
        {
          label: '购买方地址',
          englishName: 'gmfdz',
        },
        {
          label: '购买方电话',
          englishName: 'gmfdh',
        },
        {
          label: '购买方开户行',
          englishName: 'gmfkhh',
        },
        {
          label: '购买方银行账号',
          englishName: 'gmfyhzh',
        }
      ],
      list: [],
      total: 0,
      size: 10,
      current: 1,
      listDetails: []
    }
  },
  created() {
  },
  methods: {
    async getListPage() {
      this.loading = true
      let {data, code, message} = await getPage(
          {
            hprmc: this.searchParams.input1,
            infoStatus: "1",
            pageNo: this.current,
            pageSize: this.size,
          }
      )
      if (code == 200) {
        this.loading = false
        this.listDetails = data.records
        this.time = data.records[0]?.createTime

        this.total = data.total
        this.current = data.current
        this.size = data.size

      } else {
        this.$message({
          type: 'error',
          message: message,
        })
      }
      this.loading = false
    },
    rowDblclick(row) {
      this.$emit('change', false, row)
    },
    handleClose() {
      this.$emit('change', false)
    },
    handleSizeChange(val) {
      this.current = val
      this.getListPage()
    },
    handleCurrentChange(val) {
      this.current = val
      this.getListPage()
    },

  },
  components: {
    tableList
  }
}
</script>

<style lang="scss" scoped>
.flowDialog {

  input::-ms-clear {
    width: 0;
    height: 0;
  }

}
</style>